import { Gameover_state } from "../GlobalData/DataStruct"
import player_Control from "../rabbit/player_Control"
import gameScene4 from "../Game/gameScene4"

export default class gameWin4 extends Laya.Script {

    constructor() {
        super(); 
        gameWin4._instance = this
    }
    private gamewin_panel: Laya.Sprite
    private STATE1: Boolean
    private STATE2: Boolean
    public static _instance:gameWin4

    onEnable(): void {
        this.gamewin_panel = this.owner.parent.getChildByName("gamewin_panel") as Laya.Sprite
        this.Gameover()
    }

    onTriggerEnter(other: Laya.ColliderBase, self: any) {
        if (other.label == "player1") {
            this.STATE1 = true
        }
        if (this.STATE1 == true) {
            if (other.label == "player2") {
                this.gamewin_panel.visible = true
                player_Control._intance.enabled = false
                gameScene4._intance.num = 0
                return
            }
        }
    }

    Gameover() {

    }

    onDisable(): void {
    }
}